package com.study.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.mmd.bean.AdminInfoBean;
import com.mmd.utils.Myutils;
import com.study.bean.ImgBean;
import com.study.bean.PictureBean;
import com.study.service.impl.AddCarItemService;
import com.study.tools.MyTools;

/**
 * Servlet implementation class imgAction
 */
@WebServlet("/imgAction")
public class imgAction extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//向前台插入图片
		//把c_id放到实体类中
		String img01=request.getSession().getAttribute("c_id").toString();
		Integer img2=new Integer(img01);
		ImgBean ib=new ImgBean();
		ib.setC_id(img2);
		//利用c_id进行查询
		List<ImgBean> img1=MyTools.getInstance(AddCarItemService.class).getimgoneInfo(ib);	
		System.out.println("img1:"+img1);
	    String listjson=JSON.toJSONString(img1);
	    PrintWriter PW=response.getWriter();
	    PW.write(listjson);
	    PW.flush();
	    PW.close();
		
	}

	
}
